package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.Sku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

public interface SkuMapper extends BaseMapper<Sku> {

    //update tb_sku set stock =stock-num, sold=sold+num where id = xxx

  //  @Update("update tb_sku set stock = stock- #{num}, sold = sold + #{num} where id = #{skuId}")
    @Update("update tb_sku set stock = stock- #{num}, sold = sold + #{num} where id = #{id}")
    Integer minusSku(Map<String,Object> param);
   // Integer minusSku(@Param("skuId") Long skuId, @Param("num") Integer num);
}
